home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / amos / localext.lha / locale_ext / locale_ext.doc < prev    next >
Text File  |  1994-04-06  |  9KB  |  261 lines

  1.  
  2.   **** ****  ***** ***** *****  ***  *   *  ****  ****
  3.  *     *   * *     *       *     *   **  * *     *    
  4.  * *** ****  ***   ***     *     *   * * * * ***  ***
  5.  *   * *  *  *     *       *     *   *  ** *   *     *
  6.   ***  *   * ***** *****   *    ***  *   *  ***  ****
  7.  
  8.      and Welcome to Locale Extension for AMOSPro
  9.      written by Johan Östling (C) Copyright 1994
  10.  
  11. -------------------------------------------------------
  12.  
  13. Locale Extension is a set of new commands for AMOSPro
  14. that enables you to use the functions of the new
  15. locale.library present in AmigaDOS version 2.1 or
  16. higher. This library supports multi-lingual facilities
  17. for programs. In other words you can easily let your
  18. program be translated into different languages without
  19. changing the program.
  20.  
  21. This is a ßeta release - this program is not guaranteed
  22. to be without faults, and have NOT gone through
  23. extensive testing. I actually wrote this for myself to
  24. use, but I have had some requests to release this,
  25. so that's what I am doing.
  26.  
  27. Permission is hereby granted for unrestricted
  28. NON-commercial use in any of your programs.
  29. The Copyright is retained by Johan Östling (myself).
  30.  
  31. This extension does NOT require locale.library to
  32. load. Some functions require locale.library and some
  33. functions require AmigaDOS 2.0 or higher. See the
  34. command oversight to see which requires what.
  35.  
  36. -------------------------------------------------------
  37.  
  38. INSTALLING
  39. ¯¯¯¯¯¯¯¯¯¯
  40.  
  41. Copy the file Locale.Lib into the drawer where all your
  42. other AMOSPro .Lib files are (usually APSystem). Start
  43. AMOSPro and select 'Set Interpreter' from the 'Config'
  44. menu. Select 'Set Loaded Extensions' and on entry #17,
  45. enter Locale.Lib. Save configuration and restart AMOS.
  46. The extension should now be loaded. You can check this
  47. from the 'About loaded extensions' menu entry.
  48. Make sure that the extension is recorded in entry #17,
  49. otherwise it will not load. I have selected entry #17
  50. because I guess most people does not have anything there.
  51.  
  52. -------------------------------------------------------
  53.  
  54. COMMANDS
  55. ¯¯¯¯¯¯¯¯
  56.  
  57. [LOC] :== Requires locale.library
  58. [2.0] :== Requires AmigaDOS 2.0 or higher
  59.  
  60. Catalog handling commands
  61. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  62. Open Catalog CATALOG_NAME$ , DEFAULT_LANGUAGE$
  63. Open Catalog CATALOG_NAME$ , DEFAULT_LANGUAGE$ , VERSION
  64.  
  65.   Tries to open the named catalog. A catalog is a file containing
  66.   a translation of the strings used in your program.
  67.   CATALOG_NAME$ contains the name of the catalog.
  68.   DEFAULT_LANGUAGE$ names the language the strings built-in in your
  69.     program are written in.
  70.   VERSION is an optional version number. If this is specified,
  71.     the catalog must be exactly this version to be opened.
  72.   
  73.   Example:
  74.   
  75.   Open Catalog "foobar.catalog","english"
  76.   Tries to open the catalog 'foobar'. The builtin language is english.
  77.   
  78.  
  79. Close Catalog
  80.  
  81.   Closes the currently open catalog. No arguments.
  82.  
  83.  
  84. =Catalog String$(ID , DEFAULT_STRING$)
  85.  
  86.   'Translates' the string with id ID. If no translation was found or
  87.   if the builtin language is the user's preferred, the string
  88.   DEFAULT_STRING$ will be returned.
  89.   ID is the id of the string to be translated. All strings must have
  90.     an unique id.
  91.   DEFAULT_STRING$ is the default, builtin string. You MUST supply this
  92.     with a valid string.
  93.  
  94.  
  95. =Catalog Active
  96.   Simply returns 0 if no catalog is loaded, or <>0 if a catalog is
  97.   loaded. If no catalog is loaded then either the builtin language
  98.   matches the user's preference, or the user's preferred language
  99.   did not have a translation file, or locale.library was not found.
  100.   Neither of these errors are fatal - the default strings will be
  101.   returned by Catalog String$
  102.  
  103.  
  104. Emit Catalog Description FILENAME$    [2.0]
  105.   This is a neat function to simplify the creation of a catalog
  106.   description file (used when translating a program). Every time
  107.   Catalog String$ is called, it will write an entry to the file,
  108.   containing the string id and default string.
  109.   FILENAME$ is the name of the file to write.
  110.  
  111.  
  112. Emit Close
  113.   Stops the emitting of catalog description. Note: If the program
  114.   is interrupted while emitting a file, the file will still remain
  115.   open. Execute an Emit Close command, or exit AMOSPro to close the
  116.   file.
  117.  
  118.  
  119. Locale Commands
  120. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  121. =Locale String$(ID)   [LOC]
  122.   Returns a localized string (defined for the country selected).
  123.   ID is an integer higher than 0. To find out what each string is,
  124.   try this command out with a FOR loop;
  125.   
  126.     For I=1 To 100
  127.       Print I;"=";Locale String$(I)
  128.     Next I
  129.   
  130.   This will probably fail when I reach about 50, but then you'll
  131.   know. Useful strings are for example localized Yes/No strings.
  132.  
  133.  
  134. =Date$             [LOC]
  135. =Time$             [LOC]
  136. =Datetime$         [LOC]
  137. =Short Date$       [LOC]
  138. =Short Time$       [LOC]
  139. =Short Datetime$   [LOC]
  140.   Returns a string containg - well guess what.. These dates and
  141.   times are in a format supposedly standard for the country you
  142.   have selected. The Short xxx$ is also supposed to be shorter
  143.   than the others.. It is not so for swedish locale, but you go
  144.   ahead and check it out.
  145.  
  146.  
  147. =Format Date$(FORMAT$)   [LOC]
  148.   With this command you can control how the date and time will be
  149.   displayed.
  150.   FORMAT$ is a formatting string describing how the date and time
  151.     will be displayed. The commands are;
  152.     
  153.              %a - abbreviated weekday name
  154.              %A - weekday name
  155.              %b - abbreviated month name
  156.              %B - month name
  157.              %c - same as "%a %b %d %H:%M:%S %Y"
  158.              %C - same as "%a %b %e %T %Z %Y"
  159.              %d - day number with leading 0s
  160.              %D - same as "%m/%d/%y"
  161.              %e - day number with leading spaces
  162.              %h - abbreviated month name
  163.              %H - hour using 24-hour style
  164.              %I - hour using 12-hour style
  165.              %j - julian date
  166.              %m - month number with leading 0s
  167.              %M - the number of minutes with leading 0s
  168.              %n - insert a linefeed
  169.              %p - AM or PM strings
  170.              %r - same as "%I:%M:%S %p"
  171.              %R - same as "%H:%M"
  172.              %S - number of seconds with leadings 0s
  173.              %t - insert a tab character
  174.              %T - same as "%H:%M:%S"
  175.              %U - week number, taking Sunday as first day of week
  176.              %w - weekday number
  177.              %W - week number, taking Monday as first day of week
  178.              %x - same as "%m/%d/%y"
  179.              %X - same as "%H:%M:%S"
  180.              %y - year using two digits with leading 0s
  181.              %Y - year using four digits with leading 0s
  182.   
  183.   For example:
  184.   
  185.   Print Format Date$("The time is %r and the month is %B")
  186.  
  187.  
  188. =Locale Active
  189.   Checks to see if a locale is loaded. You can use this function to
  190.   exit gracefully if you intend to use any Locale commands;
  191.   
  192.   If Locale Active=0 
  193.     Print "I'm sorry, but you need locale.library for this program"
  194.     End
  195.   End If
  196.   
  197.   
  198. =Locale Compare(STRING1$ , STRING2$)           [LOC]
  199. =Locale Compare(STRING1$ , STRING2$ , LEVEL)   [LOC]
  200.   Compares the two strings and returns:
  201.   
  202.     <0 if STRING1$<STRING2$
  203.     =0 if STRING1$=STRING2$
  204.     >0 if STRING1$>STRING2$
  205.   
  206.   LEVEL specifies the level of comparing:
  207.   
  208.      0 - ordinary compare. You could skip this function and use a
  209.          straight If STRING1$=STRING2$ instead..
  210.      1 - locale light :) Does not make any difference between é and e
  211.          for example.
  212.      2 - locale standard. Will place é before f, but not equal to e.
  213.   
  214.   Note: This seems like a good function, but it is bugged. Not in my
  215.   extension though, but in the system. The swedish characters åäö,
  216.   which _should_ be last in the swedish alphabet, is instead sorted
  217.   in like this: å=ä=a and ö=o. This may be good for some languages.
  218.   But not for swedish. Now you know.
  219.   
  220.  
  221. =Locale Lower$(STRING$)   [LOC]
  222. =Locale Upper$(STRING$)   [LOC]
  223.   Works just like AMOS' normal Upper$ and Lower$, but converts
  224.   letters like å or æ or é correctly.
  225.   STRING$ is the string to convert
  226.  
  227.  
  228. =Lowerchar(CHAR)   [LOC]
  229. =Upperchar(CHAR)   [LOC]
  230.   This returns the ASCII value of the converted character. I can't
  231.   see much use for these function really, but they were real easy
  232.   to provide :)
  233.   CHAR is character to convert.
  234.   
  235.   For example:
  236.   
  237.   Print Chr$(Upperchar(Asc("a"))
  238.   
  239.   is a silly way to write
  240.   
  241.   Print Locale Upper$("a")
  242.  
  243. --------------------------------------------------------------------
  244.  
  245. That's it. I can hope that you find a use for this program.
  246. And please, if you find any bugs, write to me about them. Or
  247. if you just have any comments, or anything. This is where
  248. you can get in touch with me: (I prefer Emails..)
  249.  
  250. Email:
  251.    e92_jog@e.kth.se
  252. Snailmail:
  253.    Johan Östling
  254.    Sköndalsv. 114
  255.    128 68 Sköndal
  256.    Sweden
  257.  
  258. if you wish a reply by snailmail, include a self-adressed envelope,
  259. and I'll try to reply.
  260.  
  261.